<?php
namespace App\Models\Chain\InviteCash;



use App\Models\Factory\CashFactory;
use App\Models\Factory\InviteFactory;
use App\Models\Chain\AbstractHandler;
use App\Models\Factory\UserInviteCodeFactory;
use App\Models\Factory\V2\AwUserIntegralFactory;

/**
 * 查看用户是否已经加过积分
 * Class CreateCreditLogAction
 * @package App\Models\Chain\Identity
 */

class CheckIdentityVerifyAction extends AbstractHandler
{

    private $params = array();
    protected $error = array('error' => '用户已经加过积分', 'code' => 7001);
    private $user = null;

    public function __construct($params)
    {
        $this->params = $params;
    }


    public function handleRequest()
    {
        if ($this->CheckIdentityVerify($this->params) == true) {
            $this->setSuccessor(new CreateIdentityVerifyAction($this->params));
            return $this->getSuccessor()->handleRequest();
        } else {
            return $this->error;
        }
    }


    //检查是被邀请的用户
    public function CheckIdentityVerify($params)
    {

        //如果完成，去检查是否加过积分了
        $result = AwUserIntegralFactory::checkIdentityVerfity($params['user_id']);

        return $result;
    }


}